package com.jltx.xq.relaxnewspro.adapter;

import android.content.Context;
import android.support.v7.widget.RecyclerView;

import com.jltx.xq.relaxnewspro.database.collection.BaseCollectionCache;
import com.jltx.xq.relaxnewspro.database.collection.ICache;

import java.util.List;

/**
 * Created by bo on 2017/4/18.
 */

public abstract class BaseListAdapter<M,VH extends RecyclerView.ViewHolder> extends RecyclerView.Adapter<VH> {
    protected List<M> mItems;
    protected Context mContext;
    protected ICache<M> mCache;

    protected boolean isCollection = false;

    public BaseListAdapter(Context mContext, ICache<M> mCache) {
        this.mContext = mContext;
        this.mCache = mCache;
        mItems = mCache.getmList();

        if(mCache instanceof BaseCollectionCache){
            isCollection = true;
        }


    }

    public int getItemCount(){return mItems.size();}
    protected M getItem(int position){
        return mItems.get(position);
    }
}
